{include file="public/header" /}
<style>
    .layui-form-checkbox i{
        border-left: 1px solid #d2d2d2;
    }
    .hidden{
        display: none;
    }
    .layui-table tr,.layui-table td,.layui-table th{
        text-align: center;
        padding: 2px 0 2px 2px;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox-content layui-form">
        <div class="layui-row layui-col-space10 layui-form-item ">
            <input type="hidden" name="tsl_ts_id" value="{$tsl_ts_id}">
            <input type="text" disabled class="layui-input " value="每一行只能指定一个，可以不指定">

            <!---->
            <div class="layui-form-item">
                <table class="layui-table" style="padding: 0;margin: 0;">
                    <thead>
                    <tr>
                        <th style="text-align: center;">夏</th>
                        <th style="text-align: center;">秋</th>
                        <th style="text-align: center;">礼</th>
                        <th style="text-align: center;">冬</th>
                        <th style="text-align: center;">西</th>
                        <th>校服款号</th>
                        <th>校服名字</th>
                        <th>缩略图</th>
                        <th>性别</th>
                        <th>价格</th>
                        <th>数量</th>
                        <th>U8大货单号</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name='goods' id='vo'}
                    <tr>
                        <td style="padding-left: 10px;width: 25px;"><input {if in_array($vo['sg_id'] . '_1',$haves)}checked{/if} type="checkbox" class="layui-input" name="fahuo[]" value="{$vo.sg_id}_1" /></td>
                        <td style="padding-left: 10px;width: 25px;"><input {if in_array($vo['sg_id'] . '_2',$haves)}checked{/if} type="checkbox" class="layui-input" name="fahuo[]" value="{$vo.sg_id}_2" /></td>
                        <td style="padding-left: 10px;width: 25px;"><input {if in_array($vo['sg_id'] . '_3',$haves)}checked{/if} type="checkbox" class="layui-input" name="fahuo[]" value="{$vo.sg_id}_3" /></td>
                        <td style="padding-left: 10px;width: 25px;"><input {if in_array($vo['sg_id'] . '_4',$haves)}checked{/if} type="checkbox" class="layui-input" name="fahuo[]" value="{$vo.sg_id}_4" /></td>
                        <td style="padding-left: 10px;width: 25px;"><input {if in_array($vo['sg_id'] . '_5',$haves)}checked{/if} type="checkbox" class="layui-input" name="fahuo[]" value="{$vo.sg_id}_5" /></td>
                        <td style="width: 100px;">{$vo.sg_good_coding}</td>
                        <td>{$vo.good_name}</td>
                        <td><img src="{$vo.good_thumb}" width="50" /></td>
                        <td>
                            {if $vo.sg_sex == 1}男{/if}
                            {if $vo.sg_sex == 2}女{/if}
                            {if $vo.sg_sex == 3}通用{/if}
                        </td>
                        <td>
                            <input type="text" style="width: 70px" class="layui-input" name="price_{$vo.sg_id}" value="{$priceArray[$vo.sg_id] ?: $vo.good_price}" />
                        </td>
                        <td>
                            <input type="text" style="width: 30px" class="layui-input" name="num_{$vo.sg_id}" value="{$numArray[$vo.sg_id] ?: 1}" />
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="erp_{$vo.sg_id}" value="{$erpArray[$vo.sg_id] ?: ''}" />
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
            </div>
            <div class="layui-form-item layui-col-xs-offset1 layui-col-xs8">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                    </button>
                    <button class="layui-btn layui-btn-primary" onclick="wk.layer_close('close')">关闭</button>
                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/footer" /}
<script>
    layui.use(['form'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('button').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('setGoods')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        layer.msg(res.msg,{icon:1,time:1500,shade:0.1},function(index){
                            wk.layer_close();
                        })
                    } else {
                        $("button").removeClass('layui-disabled').removeAttr('disabled');
                        wk.error(res.msg);
                        return false;
                    }
                }
            })
        });
    });
</script>
</body>
</html>